package com.zzq.my.jetpacks.jectpackapp.ui

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import com.zzq.my.jetpacks.jectpackapp.R
import kotlinx.coroutines.*

class TestActivity : AppCompatActivity() {

    val ms = MainScope()

    @OptIn(DelicateCoroutinesApi::class)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test)

        ms.launch {

        }
        ms.cancel()


        GlobalScope.async {
            val withContext:String = withContext(Dispatchers.IO)
            {
                ""
            }
            withContext
        }

        lifecycleScope.launch {
            testCorutineScope();
        }


    }

    private suspend fun testCorutineScope()
    {
        val async = CoroutineScope(Dispatchers.IO).async {
            "xxxxxx"
        }.await()
    }
}